<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>修改密码</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="../../css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="../../css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="../../css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="../../css/animate.css" rel="stylesheet">
    <link href="../../css/plugins/ztree/style.css?v=4.1.0" rel="stylesheet">

</head>
<style type="text/css">
    .setOs{
        width: 20%;
        height: 26px;
    }
</style>
<body class="form-horizontal">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="col-sm-6" style="margin-top: 50px;margin-left: 50px ">
        <div class="form-group">
            <label for="oldPassword" class="col-sm-3 control-label">请输入旧密码:</label>
            <div class="col-sm-6">
                <input type="text" class="form-control"  id="oldPassword" placeholder="请输入旧密码">
            </div>
        </div>
        <div class="form-group">
            <label for="newPassword" class="col-sm-3 control-label">请输入新密码:</label>
            <div class="col-sm-6">
                <input type="password" class="form-control"  id="newPassword" placeholder="请输入新密码">
            </div>
        </div>
        <div class="form-group">
            <label for="queren" class="col-sm-3 control-label">确认新密码:</label>
            <div class="col-sm-6">
                <input type="password" class="form-control"  id="queren" placeholder="请再次输入新密码">
            </div>
        </div>
        <div class="form-group">
            <button id="change" class="btn" style="margin-left: 50%;margin-top: 30px" >确定</button>
        </div>

    </div>

</div>
</body>
<!-- 全局js -->
<script src="../../js/jquery.min.js?v=2.1.4"></script>
<script src="../../js/bootstrap.min.js?v=3.3.6"></script>
<!-- 自定义js -->
<script src="../../js/content.js?v=1.0.0"></script>
<!-- Bootstrap table -->
<script src="../../js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="../../js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="../../js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script type="text/javascript" src="../../js/common/auth.js"></script>

<script type="text/javascript">
    var __changePassword = "../../user/update/password";//post
    $("#change").click(function(){
        if($("#newPassword").val() != $("#queren").val()){
            alert("两次密码输入不一致，请重试")
            return false
        }
        $$ajax({
            url: __changePassword,
            type: 'post',//提交的方式
            dataType:'json',
            async:true,
            contentType:"application/json; charset=utf-8",
            data:JSON.stringify({
                oldPassword:$("#oldPassword").val(),
                password:$("#newPassword").val()
            }),
            success: function(data) {
                if (data.httpCode==200) {
                    console.log(data.msg)
                    alert("密码修改成功")
                    window.location.href= "/login.html";
                } else{
                    alert(data.msg);
                }
            }

        });
    })

</script>

</html>